#############################
##MirrorCreatorUploader	    #
##Script Bash by Benpro     #
##Mail : benpro82@gmail.com #
##Version : 0.1		    #
##Last Revision : 15-11-10  #
##Licence : GPLv3	    #
#############################
#Global Var
filename=$1
useragent="Firefox/3.6.10"
code=$(date +%s)999
uploadServices="-F hotfile=on -F megaupload=on -F depositfiles=on -F fileserve=on -F oron=on -F easyshare=on -F filefactory=on -F rapidshare=on -F zshare=on -F filesonic=on -F enterupload=on -F x7_dot_to=on -F netload=on -F uploadedto=on"
#Others upload's services : look on MirrorCreator website.

#---VerifyCurl---#
curl=$(which curl)
if [ $? != 0 ]; then
    echo "You need curl, install-it with your package manager, or compile it."
    exit 1
fi

#---Manual---#
echo "Welcome to MirrorCreatorUploader V0.1"
if [ -z "$1" ]; then
  echo "Missing file to upload."
  echo "Usage : $0 nom_du_fichier"
  exit 1
fi

#---PrincipalCode---#
getID=$($curl -# --user-agent "$useragent" http://www.mirrorcreator.com/uber/ubr_link_upload.php?rnd_id=$RANDOM | cut -d \" -f 2)
getLINK=$($curl --user-agent "$useragent" http://www.mirrorcreator.com/cgi-bin/ubr_upload.pl?upload_id=$getID -F "upfile_$code=@$filename;type=application/octet-stream" $uploadServices | grep moved | cut -d \" -f 2)
echo "Here the link \o/ : $getLINK (You need to load it into your browser to have the good one)."
exit 0